using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes.DomainAttributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Enums;
using System.Collections.Generic;
using System.ComponentModel;

namespace Baci.ArcGIS._3DAnalystTools._PointCloud
{
    /// <summary>
    /// <para>Tile LAS</para>
    /// <para>Creates a set of nonoverlapping LAS files whose horizontal extents are divided by a regular grid.</para>
    /// <para>创建一组不重叠的 LAS 文件，其水平范围由规则格网划分。</para>
    /// </summary>    
    [DisplayName("Tile LAS")]
    public class TileLas : AbstractGPProcess
    {
        /// <summary>
        /// 无参构造
        /// </summary>
        public TileLas()
        {

        }

        /// <summary>
        /// 有参构造
        /// </summary>
        /// <param name="_in_las_dataset">
        /// <para>Input LAS Dataset</para>
        /// <para>The LAS dataset to process.</para>
        /// <para>要处理的 LAS 数据集。</para>
        /// </param>
        /// <param name="_target_folder">
        /// <para>Target Folder</para>
        /// <para>The folder where the tiled LAS files will be written.</para>
        /// <para>将写入切片 LAS 文件的文件夹。</para>
        /// </param>
        public TileLas(object _in_las_dataset, object _target_folder)
        {
            this._in_las_dataset = _in_las_dataset;
            this._target_folder = _target_folder;
        }
        public override string ToolboxName => "3D Analyst Tools";

        public override string ToolName => "Tile LAS";

        public override string CallName => "3d.TileLas";

        public override List<string> AcceptEnvironments => ["extent", "outputCoordinateSystem", "scratchWorkspace", "workspace"];

        public override object[] ParameterInfo => [_in_las_dataset, _target_folder, _base_name, _out_las_dataset, _compute_stats.GetGPValue(), _las_version.GetGPValue(), _point_format, _compression.GetGPValue(), _las_options, _tile_feature, _naming_method.GetGPValue(), _file_size, _tile_width, _tile_height, _tile_origin, _out_folder];

        /// <summary>
        /// <para>Input LAS Dataset</para>
        /// <para>The LAS dataset to process.</para>
        /// <para>要处理的 LAS 数据集。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input LAS Dataset")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _in_las_dataset { get; set; }


        /// <summary>
        /// <para>Target Folder</para>
        /// <para>The folder where the tiled LAS files will be written.</para>
        /// <para>将写入切片 LAS 文件的文件夹。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Target Folder")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _target_folder { get; set; }


        /// <summary>
        /// <para>Output Base Name</para>
        /// <para>The name that each output file will begin with.</para>
        /// <para>每个输出文件的开头名称。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Base Name")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _base_name { get; set; } = null;


        /// <summary>
        /// <para>Output LAS Dataset</para>
        /// <para>The new LAS dataset that references the tiled LAS files created by this tool. This is optional.</para>
        /// <para>引用此工具创建的切片 LAS 文件的新 LAS 数据集。这是可选的。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output LAS Dataset")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _out_las_dataset { get; set; } = null;


        /// <summary>
        /// <para>Compute statistics</para>
        /// <para><xdoc>
        ///   <para>Specifies whether statistics will be computed for the .las files referenced by the LAS dataset. Computing statistics provides a spatial index for each .las file, which improves analysis and display performance. Statistics also enhance the filtering and symbology experience by limiting the display of LAS attributes, such as classification codes and return information, to values that are present in the .las file.</para>
        ///   <bulletList>
        ///     <bullet_item>Checked—Statistics will be computed. This is the default.</bullet_item><para/>
        ///     <bullet_item>Unchecked—Statistics will not be computed.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定是否为 LAS 数据集引用的 .las 文件计算统计数据。计算统计为每个 .las 文件提供空间索引，从而提高分析和显示性能。统计数据还通过将 LAS 属性（如分类代码和返回信息）的显示限制为 .las 文件中存在的值来增强过滤和符号系统体验。</para>
        ///   <bulletList>
        ///     <bullet_item>选中—将计算统计数据。这是默认设置。</bullet_item><para/>
        ///     <bullet_item>未选中—不计算统计数据。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Compute statistics")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _compute_stats_value _compute_stats { get; set; } = _compute_stats_value._true;

        public enum _compute_stats_value
        {
            /// <summary>
            /// <para>COMPUTE_STATS</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("COMPUTE_STATS")]
            [GPEnumValue("true")]
            _true,

            /// <summary>
            /// <para>NO_COMPUTE_STATS</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("NO_COMPUTE_STATS")]
            [GPEnumValue("false")]
            _false,

        }

        /// <summary>
        /// <para>Output Version</para>
        /// <para><xdoc>
        ///   <para>Specifies the LAS file version of each output file. The default is 1.4.</para>
        ///   <bulletList>
        ///     <bullet_item>1.0—This version supported 256 unique class codes but did not have a predefined classification schema.</bullet_item><para/>
        ///     <bullet_item>1.1—This version introduced a predefined classification scheme, and point record formats 0 and 1, and the synthetic classification flag for points that were derived from a source other than a lidar sensor.</bullet_item><para/>
        ///     <bullet_item>1.2—This version featured support for GPS time and RGB records in point records 2 and 3.</bullet_item><para/>
        ///     <bullet_item>1.3—This version added support for point records 4 and 5 for waveform data. However, waveform information is not read in ArcGIS.</bullet_item><para/>
        ///     <bullet_item>1.4—This version introduced point record formats 6 through 10, along with new class definitions, 256 unique class codes, and the overlap classification flag.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定每个输出文件的 LAS 文件版本。默认值为 1.4。</para>
        ///   <bulletList>
        ///     <bullet_item>1.0 - 此版本支持 256 个唯一类代码，但没有预定义的分类方案。</bullet_item><para/>
        ///     <bullet_item>1.1 - 此版本引入了预定义的分类方案、点记录格式 0 和 1，以及派生自激光雷达传感器以外的源的点的合成分类标志。</bullet_item><para/>
        ///     <bullet_item>1.2 - 此版本支持点记录 2 和 3 中的 GPS 时间和 RGB 记录。</bullet_item><para/>
        ///     <bullet_item>1.3 - 此版本增加了对波形数据的点记录 4 和 5 的支持。但是，在 ArcGIS 中不会读取波形信息。</bullet_item><para/>
        ///     <bullet_item>1.4 - 此版本引入了点记录格式 6 到 10，以及新的类定义、256 个唯一类代码和重叠分类标志。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Version")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _las_version_value? _las_version { get; set; } = null;

        public enum _las_version_value
        {
            /// <summary>
            /// <para>1.0</para>
            /// <para>1.0—This version supported 256 unique class codes but did not have a predefined classification schema.</para>
            /// <para>1.0 - 此版本支持 256 个唯一类代码，但没有预定义的分类方案。</para>
            /// </summary>
            [Description("1.0")]
            [GPEnumValue("1.0")]
            value0,

            /// <summary>
            /// <para>1.1</para>
            /// <para>1.1—This version introduced a predefined classification scheme, and point record formats 0 and 1, and the synthetic classification flag for points that were derived from a source other than a lidar sensor.</para>
            /// <para>1.1 - 此版本引入了预定义的分类方案、点记录格式 0 和 1，以及派生自激光雷达传感器以外的源的点的合成分类标志。</para>
            /// </summary>
            [Description("1.1")]
            [GPEnumValue("1.1")]
            value1,

            /// <summary>
            /// <para>1.2</para>
            /// <para>1.2—This version featured support for GPS time and RGB records in point records 2 and 3.</para>
            /// <para>1.2 - 此版本支持点记录 2 和 3 中的 GPS 时间和 RGB 记录。</para>
            /// </summary>
            [Description("1.2")]
            [GPEnumValue("1.2")]
            value2,

            /// <summary>
            /// <para>1.3</para>
            /// <para>1.3—This version added support for point records 4 and 5 for waveform data. However, waveform information is not read in ArcGIS.</para>
            /// <para>1.3 - 此版本增加了对波形数据的点记录 4 和 5 的支持。但是，在 ArcGIS 中不会读取波形信息。</para>
            /// </summary>
            [Description("1.3")]
            [GPEnumValue("1.3")]
            value3,

            /// <summary>
            /// <para>1.4</para>
            /// <para>1.4—This version introduced point record formats 6 through 10, along with new class definitions, 256 unique class codes, and the overlap classification flag.</para>
            /// <para>1.4 - 此版本引入了点记录格式 6 到 10，以及新的类定义、256 个唯一类代码和重叠分类标志。</para>
            /// </summary>
            [Description("1.4")]
            [GPEnumValue("1.4")]
            value4,

        }

        /// <summary>
        /// <para>Point Format</para>
        /// <para>The point record format of the output LAS files. The available options will vary based on the LAS file version specified in the Output Version parameter.</para>
        /// <para>输出 LAS 文件的点记录格式。可用选项将因输出版本参数中指定的 LAS 文件版本而异。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Point Format")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public long? _point_format { get; set; } = null;


        /// <summary>
        /// <para>Compression</para>
        /// <para><xdoc>
        ///   <para>Specifies whether the output LAS file will be in a compressed format or the standard LAS format.</para>
        ///   <bulletList>
        ///     <bullet_item>No Compression—The output will be in the standard LAS format (*.las file). This is the default.</bullet_item><para/>
        ///     <bullet_item>zLAS Compression—Output LAS files will be compressed in the zLAS format.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定输出 LAS 文件是压缩格式还是标准 LAS 格式。</para>
        ///   <bulletList>
        ///     <bullet_item>无压缩—输出将采用标准 LAS 格式（*.las 文件）。这是默认设置。</bullet_item><para/>
        ///     <bullet_item>zLAS 压缩—输出 LAS 文件将以 zLAS 格式进行压缩。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Compression")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _compression_value _compression { get; set; } = _compression_value._NO_COMPRESSION;

        public enum _compression_value
        {
            /// <summary>
            /// <para>No Compression</para>
            /// <para>No Compression—The output will be in the standard LAS format (*.las file). This is the default.</para>
            /// <para>无压缩—输出将采用标准 LAS 格式（*.las 文件）。这是默认设置。</para>
            /// </summary>
            [Description("No Compression")]
            [GPEnumValue("NO_COMPRESSION")]
            _NO_COMPRESSION,

            /// <summary>
            /// <para>zLAS Compression</para>
            /// <para>zLAS Compression—Output LAS files will be compressed in the zLAS format.</para>
            /// <para>zLAS 压缩—输出 LAS 文件将以 zLAS 格式进行压缩。</para>
            /// </summary>
            [Description("zLAS Compression")]
            [GPEnumValue("ZLAS")]
            _ZLAS,

        }

        /// <summary>
        /// <para>LAS Options</para>
        /// <para><xdoc>
        ///   <para>A list of optional modifications to the output LAS files.</para>
        ///   <bulletList>
        ///     <bullet_item>Rearrange Points—LAS points will be arranged according to their spatial clustering.</bullet_item><para/>
        ///     <bullet_item>Remove Variable Length Records—Variable-length records that are added after the header and the point records of each file will be removed.</bullet_item><para/>
        ///     <bullet_item>Remove Extra Bytes—Extra bytes that are present with each point record in the input LAS file will be removed.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>对输出 LAS 文件的可选修改列表。</para>
        ///   <bulletList>
        ///     <bullet_item>重排点—LAS 点将根据其空间聚类进行排列。</bullet_item><para/>
        ///     <bullet_item>移除可变长度记录 （Remove Variable Length Records） - 将移除在标题和每个文件的点记录之后添加的可变长度记录。</bullet_item><para/>
        ///     <bullet_item>移除额外字节—将移除输入 LAS 文件中每个点记录存在的额外字节。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("LAS Options")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public List<object> _las_options { get; set; } = null;


        /// <summary>
        /// <para>Import from Feature Class</para>
        /// <para>The polygon features that define the tile width and height to be used when tiling the lidar data. The polygons are presumed to be rectangular, and the first feature's extent is used to define the tile width and height.</para>
        /// <para>定义切片激光雷达数据时要使用的切片宽度和高度的面要素。面假定为矩形，第一个要素的范围用于定义切片宽度和高度。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Import from Feature Class")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _tile_feature { get; set; } = null;


        /// <summary>
        /// <para>Naming Method</para>
        /// <para><xdoc>
        ///   <para>Specifies the method used to provide a unique name for each output LAS file. Each file name will be appended to the text specified in the Output Base Name parameter. When input features are used to define the tiling scheme, its text or numeric field names will also be included as a source for defining the file name. The following automatically generated naming conventions are supported:</para>
        ///   <bulletList>
        ///     <bullet_item>XY Coordinates—The X and Y coordinates of the center point of each tile will be appended. This is the default.</bullet_item><para/>
        ///     <bullet_item>Rows and Columns—The tile name will be assigned based on the row and column it belongs to in the overall tiling scheme. The rows increment from the top down, while the columns increment from left to right.</bullet_item><para/>
        ///     <bullet_item>Ordinal Designation—The tile name will be assigned based on its order of creation, where 1 is the first tile, 2 is the second, and so on.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定用于为每个输出 LAS 文件提供唯一名称的方法。每个文件名都将追加到“输出基名”参数中指定的文本中。当使用输入要素定义切片方案时，其文本或数字字段名称也将作为定义文件名的源包含在内。支持以下自动生成的命名约定：</para>
        ///   <bulletList>
        ///     <bullet_item>XY 坐标—将追加每个切片中心点的 X 和 Y 坐标。这是默认设置。</bullet_item><para/>
        ///     <bullet_item>行和列 - 切片名称将根据其在整个切片方案中所属的行和列进行分配。行从上到下递增，而列从左到右递增。</bullet_item><para/>
        ///     <bullet_item>序号指定 - 将根据切片名称的创建顺序进行分配，其中 1 是第一个切片，2 是第二个切片，依此类推。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Naming Method")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _naming_method_value _naming_method { get; set; } = _naming_method_value._XY_COORDS;

        public enum _naming_method_value
        {
            /// <summary>
            /// <para>XY Coordinates</para>
            /// <para>XY Coordinates—The X and Y coordinates of the center point of each tile will be appended. This is the default.</para>
            /// <para>XY 坐标—将追加每个切片中心点的 X 和 Y 坐标。这是默认设置。</para>
            /// </summary>
            [Description("XY Coordinates")]
            [GPEnumValue("XY_COORDS")]
            _XY_COORDS,

            /// <summary>
            /// <para>Rows and Columns</para>
            /// <para>Rows and Columns—The tile name will be assigned based on the row and column it belongs to in the overall tiling scheme. The rows increment from the top down, while the columns increment from left to right.</para>
            /// <para>行和列 - 切片名称将根据其在整个切片方案中所属的行和列进行分配。行从上到下递增，而列从左到右递增。</para>
            /// </summary>
            [Description("Rows and Columns")]
            [GPEnumValue("ROW_COLUMN")]
            _ROW_COLUMN,

            /// <summary>
            /// <para>Ordinal Designation</para>
            /// <para>Ordinal Designation—The tile name will be assigned based on its order of creation, where 1 is the first tile, 2 is the second, and so on.</para>
            /// <para>序号指定 - 将根据切片名称的创建顺序进行分配，其中 1 是第一个切片，2 是第二个切片，依此类推。</para>
            /// </summary>
            [Description("Ordinal Designation")]
            [GPEnumValue("ORDINAL")]
            _ORDINAL,

        }

        /// <summary>
        /// <para>Target File Size (MB)</para>
        /// <para><xdoc>
        ///   <para>This value, which is expressed in megabytes, represents the upper limit of the uncompressed file size of an output LAS tile with uniform point distribution across its entire extent. The default is 250, and the value is used to estimate the tile width and height.</para>
        ///   <para>The value of this parameter changes when the Tile Width and Tile Height parameters are modified. When input features are specified in the Import from Feature Class parameter, this parameter will be disabled.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>此值以兆字节表示，表示输出 LAS 切片的未压缩文件大小上限，其整个范围的点分布均匀。默认值为 250，该值用于估计图块宽度和高度。</para>
        ///   <para>修改“瓦片宽度”和“瓦片高度”参数时，此参数的值会发生变化。在从要素类导入参数中指定输入要素时，此参数将被禁用。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Target File Size (MB)")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public double _file_size { get; set; } = 250;


        /// <summary>
        /// <para>Tile Width</para>
        /// <para>The width of each tile. Specifying a value will update the target file size and point count if a tile height is also present. Similarly, if the target file size or point count is independently updated, the tile width and height will also be changed to reflect the size of the corresponding tile. When input features are specified in the Import from Feature Class parameter, the tile width will be derived from the height of the first feature, and this parameter will be disabled.</para>
        /// <para>每个图块的宽度。如果还存在切片高度，则指定值将更新目标文件大小和点计数。同样，如果目标文件大小或点计数独立更新，则切片宽度和高度也将更改以反映相应切片的大小。在从要素类导入参数中指定输入要素时，切片宽度将从第一个要素的高度派生，并且此参数将被禁用。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Tile Width")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public string? _tile_width { get; set; } = null;


        /// <summary>
        /// <para>Tile Height</para>
        /// <para>The height of each tile. Specifying a value will update the target file size if a tile width is also present. Similarly, if the target file size is independently updated, the tile width and height will also be proportionately changed to reflect the size of the corresponding tile. When input features are specified in the Import from Feature Class parameter, the tile height will be derived from the height of the first feature, and this parameter will be disabled.</para>
        /// <para>每个图块的高度。如果还存在切片宽度，则指定值将更新目标文件大小。同样，如果目标文件大小独立更新，则切片宽度和高度也将按比例更改以反映相应切片的大小。在从要素类导入参数中指定输入要素时，切片高度将从第一个要素的高度派生，并且此参数将被禁用。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Tile Height")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public string? _tile_height { get; set; } = null;


        /// <summary>
        /// <para>Tile Origin</para>
        /// <para>The coordinates of the origin of the tiling grid. The default values are obtained from the lower left corner of the input LAS dataset. When input features are specified in the Import from Feature Class parameter, the origin will be inherited from the lower left corner of the first feature, and this parameter will be disabled.</para>
        /// <para>平铺网格原点的坐标。默认值是从输入 LAS 数据集的左下角获取的。在从要素类导入参数中指定输入要素时，将从第一个要素的左下角继承原点，并禁用此参数。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Tile Origin")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _tile_origin { get; set; } = null;


        /// <summary>
        /// <para>Output Folder</para>
        /// <para></para>
        /// <para></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Folder")]
        [Description("")]
        [Option(OptionTypeEnum.derived)]
        public object _out_folder { get; set; }


        public TileLas SetEnv(object extent = null, object outputCoordinateSystem = null, object scratchWorkspace = null, object workspace = null)
        {
            base.SetEnv(extent: extent, outputCoordinateSystem: outputCoordinateSystem, scratchWorkspace: scratchWorkspace, workspace: workspace);
            return this;
        }

    }

}